import 'dart:convert';


class VehicleGeogListItem {
  String? areaId;
  String? areaName;
  String? brandCode;
  String? definedAreaId;
  num? distance;
  String? districtId;
  int? helmetFixStatus;
  num? lat;
  num? lng;
  num? soc;
  String? model;
  String? plateNo;
  String? remark;
  int? useState;
  String? vid;

  String? errorMsg;

  VehicleGeogListItem(
      {this.areaId,
      this.areaName,
      this.brandCode,
      this.definedAreaId,
      this.distance,
      this.districtId,
      this.helmetFixStatus,
      this.lat,
      this.lng,
      this.soc,
      this.model,
      this.plateNo,
      this.remark,
      this.useState,
      this.vid,
      this.errorMsg,
      });

  VehicleGeogListItem.fromJson(Map<String, dynamic> json) {
    areaId = json['area_id'];
    areaName = json['area_name'];
    brandCode = json['brand_code'];
    definedAreaId = json['defined_area_id'];
    distance = json['distance'];
    districtId = json['district_id'];
    helmetFixStatus = json['helmet_fix_status'];
    lat = json['lat'];
    lng = json['lng'];
    soc = json['soc'];
    model = json['model'];
    plateNo = json['plate_no'];
    remark = json['remark'];
    useState = json['use_state'];
    vid = json['vid'];
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = <String, dynamic>{};
    data['area_id'] = areaId;
    data['area_name'] = areaName;
    data['brand_code'] = brandCode;
    data['defined_area_id'] = definedAreaId;
    data['distance'] = distance;
    data['district_id'] = districtId;
    data['helmet_fix_status'] = helmetFixStatus;
    data['lat'] = lat;
    data['lng'] = lng;
    data['soc'] = soc;
    data['model'] = model;
    data['plate_no'] = plateNo;
    data['remark'] = remark;
    data['use_state'] = useState;
    data['vid'] = vid;
    return data;
  }

  factory VehicleGeogListItem.error(String error){
    return VehicleGeogListItem(errorMsg: error.replaceAll('Exception', ''));
  }
}

List<VehicleGeogListItem> vehicleGeogListFromJson(String str) =>
    List<VehicleGeogListItem>.from(
        json.decode(str).map((x) => VehicleGeogListItem.fromJson(x)));

String vehicleGeogListToJson(List<VehicleGeogListItem> data) =>
    json.encode(List<dynamic>.from(data.map((x) => x.toJson())));
